<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="com.webledger.db.DBClass"%>
<%@page import="java.sql.Connection"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sa" uri="/struts-dojo-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Home</title>
<link rel="stylesheet" href="CssFiles/common.css" type="text/css">
<link rel="stylesheet" href="CssFiles/HomeMenubar.css" type="text/css">
<script type="text/javascript" src="JS/jquery-1.9.1.js"></script>
<script type="text/javascript" src="JS/jquery-ui-1.10.1.custom.js"></script>
<script type="text/javascript" src="JS/CommoanJavaScript.js"></script>
<sa:head />
<script type="text/javascript">
	$(document).ready(
			function() {
				$("#ledgername").autocomplete(
						{
							source : "search.php",
							minLength : 2,
							select : function(event, ui) {
								log(ui.item ? "Selected: " + ui.item.value
										+ " aka " + ui.item.id
										: "Nothing selected, input was "
												+ this.value);
							}
						});
			});
	function GetMnt() {
		var voucherID = document.getElementById("VouType").value;
	}
	startList = function() {
		if (document.all && document.getElementById) {
			var navRoot = document.getElementById("trans-nav");
			for (i = 0; i < navRoot.childNodes.length; i++) {
				var node = navRoot.childNodes[i];
				if (node.nodeName == "LI") {
					node.onmouseover = function() {
						this.className += " over";
					}
					node.onmouseout = function() {
						this.className = this.className.replace(" over", "");
					}
				}
			}
		}
	}
	window.onload = startList;
</script>
<style type="text/css">
</style>
</head>
<body onload="addRowToTable('bodyTabel');">
	<div class="InnerMainDiv">
		<div class="InnerBodyDiv">
			<div class="InnerHeaderContent">
				<div class="partyname">ABC Company Pvt.</div>
				<div class="usercontent">
					<div class="loginuser">
						Welcome-
						<s:property value="username" />
					</div>
					<div class="setting">Setting</div>
				</div>
			</div>
			<div class="InnerMenuBar">

				<ul id="trans-nav">
					<li><a href="#" id="Location" class="homeMenu1">Home</a></li>
					<li><a href="#">About</a></li>
					<li><a href="#">Products</a>
						<ul>
							<li><a href="#">Widgets</a></li>
							<li><a href="#">Thingamabobs</a></li>
							<li><a href="#">Doohickies</a></li>
						</ul></li>
					<li><a href="#">Contact</a></li>
				</ul>
			</div>
			<div class="Ineerbody" id="InnerBody">
				<div class="IneerContent smallFont allborder">
					<div style="width: 100%;">
						<label></label>Date :</label>
						<sa:datetimepicker id="date" title="checked" name="date"
							displayFormat="dd-MMM-yyyy" value="%{'today'}"></sa:datetimepicker>
						<label>Type :</label>
						<s:select id="VouType" autoComplete="true"
							name="ledgervoucherType" list="vouchertype" listKey="id"
							listValue="name" headerValue="VoucherType"></s:select>
						<label>PartyName :</label> <input type="text" title="checked"
							id="ledgername" id="ledgername" class="txtBig" /> <span
							id="errorlabel"></span>
					</div>
					<div style="width: 100%; margin-top: 5px;">
						<label>Ref No :</label>
						<s:textfield id="refno" name="refno" title="checked"
							cssClass="txtSmall"></s:textfield>
						<s:label>Amount :</s:label>
						<s:textfield title="checked" id="amount"></s:textfield>
						<label>Remark :</label>
						<s:textfield title="checked" id="remark" cssClass="txtBig"></s:textfield>
						<input type="button" value="Ok"  onclick="Demo();" /> <input
							type="button" value="Cancel" />
					</div>
				</div>
				<%
					String Query = "select ve.VoucherEntryNo,ve.VoucherDate,ve.VoucherTypeCode,le.LedgerName,ve.Debit,ve.Credit,ve.BillNo,ve.Remark,ve.CompanyNo from VoucherEntry ve inner join Ledger le on ve.LedgerNo = le.LedgerNo";
					Connection con = DBClass.getDB().getConnection();
					PreparedStatement ps = con.prepareStatement(Query);
					ResultSet rs = ps.executeQuery();
				%>
				<div class="tabelDiv">
					<table id="bodyTabel" class="bodyTabel smallFont">
						<tr>

							<td width="30px;">Srno</td>
							<td width="90px;">Date</td>
							<td width="120px;">Particluars</td>
							<td width="300px;">Party Name</td>
							<td width="60px;">Debit</td>
							<td width="60px;">Credit</td>
							<td width="30px;">RefNo</td>
							<td>Remark</td>
						</tr>
						<%
							while (rs.next()) {
						%>
						<tr>
							<td><%=rs.getInt(1)%></td>
							<td><%=rs.getDate(2)%></td>
							<td><%=rs.getInt(3)%></td>
							<td><%=rs.getString(4)%></td>
							<td><%=rs.getFloat(5)%></td>
							<td><%=rs.getFloat(6)%></td>
							<td><%=rs.getString(7)%></td>
							<td><%=rs.getString(8)%></td>
						</tr>
						<%
							}
						rs.close();
						con.close();
						%>
					</table>
				</div>
				<div calss="TranButton">
					<div style="float: right">
						<input type="button" value="&lt;&lt;" /> <input type="button"
							value="&lt;" /> <input type="button" value="&gt;" /> <input
							type="button" value="&gt;&gt;" /> <input type="button"
							value="Save" /> <input type="button" value="Cancel" />
					</div>

				</div>
			</div>
		</div>
	</div>
</body>
</html>